package com.springtiles.web;

import java.util.List;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.ModelMap;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;

import com.springtiles.entity.Userinfo;
import com.springtiles.service.UserinfoService;

@Controller
public class UserController {
	private Logger log = LoggerFactory.getLogger(UserController.class);

	@Autowired
	private UserinfoService userinfoService;

	@RequestMapping(value = "/userlist.do", method = RequestMethod.GET)
	public String userlist(ModelMap model) {
		log.info("showuser");
		List<Userinfo> users = userinfoService.findAllUsers();
		model.addAttribute("allusers", users);
		return "user";
	}
}
